package com.patterns.agent.dynamicagent;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @Author Tanyu
 * @Date 2020/6/2 11:51
 * @Description
 * @Version 1.0
 */
public class MyInvocationHandle implements InvocationHandler {
  private Object target;
  public void setTarget(Object target){
    this.target=target;
  }
  @Override
  public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
    DogUtils.method1();
    method.invoke(target,args);
    DogUtils.method2();
    return null;
  }
}
